package com.hs.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hs.entity.PsychReply;
import com.hs.mapper.PsychReplyMapperr;
import com.hs.service.PsychReplyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class PsychReplyServiceImpl implements PsychReplyService {
    @Autowired
    PsychReplyMapperr psychReplyMapperr;
    @Override
    public int addPsychReply(PsychReply psychReply) {
        return psychReplyMapperr.addPsychReply(psychReply);
    }

    @Override
    public int deletePsychReply(int id) {
        return psychReplyMapperr.deletePsychReply(id);
    }

    @Override
    public int updatePsychReply(PsychReply psychReply) {
        return psychReplyMapperr.updatePsychReply(psychReply);
    }

    @Override
    public PsychReply getPsychReply(int id) {
        return psychReplyMapperr.getPsychReply(id);
    }

    @Override
    public PageInfo<PsychReply> getPsychReplyByPage(PsychReply psychReply, int pageNum, int pageSize) {
        PageHelper.startPage(pageNum, pageSize);
        List<PsychReply> list = psychReplyMapperr.getPsychReplyByPage(psychReply);
        PageInfo<PsychReply> pageInfo = new PageInfo<>(list);
        return pageInfo;
    }

    @Override
    public PageInfo<PsychReply> getpsychreplylist(PsychReply psychReply) {
        List<PsychReply> getpsychreplylist = psychReplyMapperr.getpsychreplylist(psychReply);
        PageInfo<PsychReply> pageInfo = new PageInfo<>(getpsychreplylist);
        return pageInfo;
    }

    @Override
    public PageInfo<PsychReply> getAllByPage(int pageNum, int pageSize) {
        PageHelper.startPage(pageNum, pageSize);
        List<PsychReply> list=psychReplyMapperr.getAll();
        PageInfo<PsychReply> pageInfo = new PageInfo<>(list);
        return pageInfo;
    }

    @Override
    public PsychReply getAllById(int id) {
        return psychReplyMapperr.getAllById(id);
    }

    @Override
    public List<PsychReply> getPsychReplyById(int id) {
        return psychReplyMapperr.getPsychReplyById(id);
    }
}
